#ifndef _KBSORT_H

#include <Windows.h>

LRESULT CALLBACK LowLevelKeyboardProc(int code, WPARAM wParam, LPARAM lParam);

void CALLBACK TimeProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);

void printFailKeys();

int checkResult();

void uExit(int ExitCode);

void dumpToFile(char *fName, int result);

void usage();

int checkIsFailed();

/**
* Config area.... Start....
**/
struct kbstore {
	int sc;
	char Keys[11];
	int Count;
	int flag;
	int keyNum;
};

typedef struct kbscan{
	DWORD scanCode;
	DWORD flags;
} KBSCAN;

struct kbstore kbtest[]={
	/* Scancode,   Keys,   Count,   Flag, Key numbers  */
	{1, "ESC", 0, 0 , 1},
	{2, "1", 0, 0	, 1}, 
	{3, "2", 0, 0	, 1}, 
	{4, "3", 0, 0	, 1}, 
	{5, "4", 0, 0	, 1}, 
	{6, "5", 0, 0	, 1}, 
	{7, "6", 0, 0	, 1}, 
	{8, "7", 0, 0	, 1}, 
	{9, "8", 0, 0	, 1}, 
	{10, "9", 0, 0	, 1}, 
	{11, "0", 0, 0	, 1}, 
	{12, "-", 0, 0	, 1}, 
	{13, "=", 0, 0	, 1}, 
	{14, "Backspace", 0, 0, 1}, 
	{69, "NumLock", 0, 0, 1}, 
	{53, "/", 0, 1, 2}, 
	{53, "?", 0, 0, 2}, 
	{55, "*", 0, 0, 2},
	{0x37, "PrtSc", 0, 1,  2}, // PrtSc key
	{0x29, "~", 0, 0,  1},
	{74, "-", 0, 0, 1}, 
	{15, "Tab", 0, 0, 1}, 
	{16, "Q", 0, 0, 1}, 
	{17, "W", 0, 0, 1}, 
	{18, "E", 0, 0, 1}, 
	{19, "R", 0, 0, 1}, 
	{20, "T", 0, 0, 1}, 
	{21, "Y", 0, 0, 1}, 
	{22, "U", 0, 0, 1}, 
	{23, "I", 0, 0, 1}, 
	{24, "O", 0, 0, 1}, 
	{25, "P", 0, 0, 1}, 
	{26, "[", 0, 0, 1}, 
	{27, "]", 0, 0, 1}, 
	{43, "|", 0, 0, 1}, 
	{71, "Num_7", 0, 0, 2},
	{0x47, "Home", 0, 1,  2},
	{72, "Num_8", 0, 0, 2}, 
	{72, "Up", 0, 1, 2}, 
	{73, "Num_9", 0, 0, 2},
	{0x49, "PgUp", 0, 1,  2},
	{78, "+", 0, 0, 1}, 
	{58, "Caps", 0, 0, 1}, 
	{30, "A", 0, 0, 1}, 
	{31, "S", 0, 0, 1}, 
	{32, "D", 0, 0, 1}, 
	{33, "F", 0, 0, 1}, 
	{34, "G", 0, 0, 1}, 
	{35, "H", 0, 0, 1}, 
	{36, "J", 0, 0, 1}, 
	{37, "K", 0, 0, 1}, 
	{38, "L", 0, 0, 1}, 
	{39, ":", 0, 0, 1}, 
	{40, "\"", 0, 0, 1}, 
	{28, "Enter", 0, 0, 2}, 
	{28, "Enter", 0, 1, 2}, 
	{75, "Num_4", 0, 0, 2}, 
	{75, "Left", 0, 1, 2}, 
	{76, "Num_5", 0, 0, 1}, 
	{77, "Num_6", 0, 0, 2}, 
	{77, "Right", 0, 1, 2}, 
	{42, "L_Shift", 0, 0, 1}, 
	{44, "Z", 0, 0, 1}, 
	{45, "X", 0, 0, 1}, 
	{46, "C", 0, 0, 1}, 
	{47, "V", 0, 0, 1}, 
	{48, "B", 0, 0, 1}, 
	{49, "N", 0, 0, 1}, 
	{50, "M", 0, 0, 1}, 
	{51, "<", 0, 0, 1}, 
	{52, ">", 0, 0, 1}, 
	{54, "R_Shift", 0, 0, 1}, 
	{79, "Num_1", 0, 0, 2}, 
	{0x4f, "End", 0, 1,  2},
	{80, "Num_2", 0, 0, 2}, 
	{80, "Down", 0, 1, 2}, 
	{81, "Num_3", 0, 0, 2},
	{0x51, "PgDn", 0, 1,  2},
	{29, "L_Ctrl", 0, 0, 2}, 
	{29, "R_Ctrl", 0, 1, 2}, 
	//{120, "Fn", 0, 0, 1}, // 2018-03-08
	{56, "L_Alt", 0, 0, 2},
	{56, "R_Alt", 0, 1, 2}, 
	{57, "Space", 0, 0, 1}, 
	{93, "App", 0, 1, 1}, 
	{82, "Num_0", 0, 0, 2}, 
	//{0x52, "Insert", 0, 1,  2}, // 2018-03-08
	{83, "Num_.", 0, 0, 2},
	{0x53, "Del", 0, 1,  2},
	{0x5c, "Fn-USB", 0, 0, 1},
	{0x5b, "L_Win", 0, 1, 2}, // 2018-03-08
	{0x3b, "F1", 0, 0,  1},
	{0x3c, "F2", 0, 0,  1},
	{0x3d, "F3", 0, 0,  1},
	{0x3e, "F4", 0, 0,  1},
	{0x3f, "F5", 0, 0,  1},
	{0x40, "F6", 0, 0,  1},
	{0x41, "F7", 0, 0,  1},
	{0x42, "F8", 0, 0,  1},
	{0x43, "F9", 0, 0,  1},
	{0x44, "F10", 0, 0,  1},
	{0x56, "\\", 0, 0,  1 },
	{0x57, "F11", 0, 0,  1},
	{0x58, "F12", 0, 0,  1}
//	{566, "Unknown", 0, 1, 1}
};

/**
* Config area.... Ending....
**/

#endif